package com.his.registration.mapper;

import com.his.dto.RegistLevelIdFee;
import com.his.registration.pojo.Employee;
import com.his.registration.pojo.Register;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @BelongsProject: workspace-idea
 * @BelongsPackage: com.his.registration.mapper
 * @Author: ZhangYing
 * @Date: 2023/7/1 14:44
 * @Description:
 */
@Mapper
public interface RegisterMapper {
    //动态插入患者信息
    public int insert(Register register);

    //获取最后一条病历号
    @Select("SELECT case_number FROM register ORDER BY case_number DESC LIMIT 1;")
    public String getLastCaseNum();

    //多条件模糊查询患者信息
    public List<Register> selectForPatients(String caseNumber,String realName,int visitState);

    //根据病历号进行退号、叫号
    @Update("update register set visit_state=#{visitState} where case_number=#{caseNumber}")
    public int updateVisitState(String caseNumber,int visitState);

    //根据看诊状态进行显示
    @Select("select * from register where visit_state=#{visitState}")
    public List<Register> selectByVisitState(int visitState);

    //根据id拿到患者信息
    @Select("select * from register where id=#{id}")
    public Register selectById(int id);

    //根据病历号得到挂号id
    @Select("select id from register where case_number=#{caseNumber}")
    public int getRegistId(String caseNumber);

    //确定的查询
    public Register getOne(String caseNumber,String realName);
}
